import Vue from "vue";
import VueRouter from "vue-router";
import Login from "../views/Login.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "login",
    component: Login,
  },
  {
    path: "/register",
    name: "register",
    component: () => import("../views/register.vue"),
  },
  {
    path: "/home",
    name: "home",
    component: () => import("../views/Home.vue"),
    redirect: "/home/homePage", // 添加此行以设置默认重定向
    children: [
      {

        path: "/home/homePage",
        name: "homePage",
        component: () => import("../views/homePage.vue"),
      },
      {
        path: "/home/manager",
        name: "user",
        component: () => import("../views/Manager.vue"),
      },
      {

        path: "/home/user",
        name: "user",
        component: () => import("../views/User.vue"),
      },
      {
        path: "/home/animal",
        name: "animal",
        component: () => import("../views/Animal.vue"),
      },
      {
        path: "/home/adopt",
        name: "adopt",
        component: () => import("../views/Adopt.vue"),
      },

      {
        path: "/home/jiyang",
        name: "jiyang",
        component: () => import("../views/jiyang.vue"),
      },
      {
        path: "/home/room",
        name: "room",
        component: () => import("../views/Room.vue"),
      },
      {
        path: "/home/liulang",
        name: "liulang",
        component: () => import("../views/liulang.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
